const httpApi = {}
import store from '@/store'

httpApi.get = ((url, params) => {
	let baseUrl = store.state.common.host
	let tokenInfo = store.getters['user/getTokenInfo']
	let token = (tokenInfo !== null && tokenInfo.access_token) ? tokenInfo.access_token : null
	return new Promise(resolve => {
		uni.request({
		    url: baseUrl + url, 
		    data: params,
			method: 'get',
		    header: {
		        'token': token 
		    },
		    success: (res) => {
				resolve(res.data)
		    }
		})
	})
})


export default httpApi